package controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;


/**
 * @description @Controller表示该类是一个控制器
 * @author Leon Plious
 * @date 2020年7月9日
 */
@Controller
public class HelloController {

	@RequestMapping("/hello")
	public ModelAndView handleRequest(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse) throws Exception{
		
		ModelAndView mav = new ModelAndView("hello");
		mav.addObject("message", "hello!");
		
		return mav;
	}
	
	/**
	 * @description 客户端跳转
	 * @return
	 * @date 2020年7月9日
	 */
	@RequestMapping("go")
	public ModelAndView goToIndex() {
		ModelAndView modelAndView = new ModelAndView("redirect:/index");
		
		return modelAndView;
	}
	
}
